// ChildDlg.cpp: 实现文件
//

#include "pch.h"
#include "通讯录.h"
#include "afxdialogex.h"
#include "ChildDlg.h"


// ChildDlg 对话框

IMPLEMENT_DYNAMIC(ChildDlg, CDialogEx)

ChildDlg::ChildDlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_ChildDlg, pParent)
	, m_name(_T(""))
	, m_sex(_T(""))
	, m_tele(_T(""))
	, m_address(_T(""))
	, m_mailcode(_T(""))
	, m_mail(_T(""))
	, m_QQ(_T(""))
	, m_type(_T(""))
{

}

ChildDlg::~ChildDlg()
{
}

void ChildDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_name);
	DDX_Text(pDX, IDC_EDIT2, m_sex);
	DDX_Text(pDX, IDC_EDIT3, m_tele);
	DDX_Text(pDX, IDC_EDIT4, m_address);
	DDX_Text(pDX, IDC_EDIT5, m_mailcode);
	DDX_Text(pDX, IDC_EDIT6, m_mail);
	DDX_Text(pDX, IDC_EDIT7, m_QQ);
	DDX_Text(pDX, IDC_EDIT8, m_type);
}


BEGIN_MESSAGE_MAP(ChildDlg, CDialogEx)
	ON_BN_CLICKED(IDOK, &ChildDlg::OnBnClickedOk)
	ON_BN_CLICKED(IDCANCEL, &ChildDlg::OnBnClickedCancel)
END_MESSAGE_MAP()


// ChildDlg 消息处理程序


void ChildDlg::OnBnClickedOk()  //确定按钮的定义
{
	// TODO: 在此添加控件通知处理程序代码
	UpdateData(TRUE); //更新编辑框上的内容
	if (m_name == TEXT("") || m_sex == TEXT("") || m_tele == TEXT("") || m_address == TEXT("") || m_mailcode == TEXT("") || m_mail == TEXT("") || m_QQ == TEXT("") || m_type == TEXT("")) {
		MessageBox(TEXT("您有未输入的联系人信息，请补充完整"), TEXT("提示"));
	}
	else {
		OnOK();
		return;
	}
}


void ChildDlg::OnBnClickedCancel() //取消按钮的定义
{
	// TODO: 在此添加控件通知处理程序代码
	EndDialog(0);
}
